<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.kylin.module.shop.orm.*,
				 com.kylin.common.*,
                 com.kylin.common.util.*,
                 com.kylin.common.paginate.DisplayPage,
				 com.kylin.module.user.orm.*" %>
<%@ include file="/common/include/taglibs.jsp"%>
<%@ include file="/common/include/pageExpires.jsp"%>
<br>
		<b>《待审核商家申请表》</b>
	<hr>
<mytag:MyActionMsg />
<table class='pageTable' cellspacing='0' cellpadding='0'> 
     <tr>
        <td class='pageTitle'>顺序号</td>
		<td class='pageTitle'>用户名</td>
		<td class='pageTitle'>公司名称</td>
		<td class='pageTitle'>所属国家</td>
		<td class='pageTitle'>主营行业</td>
		<td class='pageTitle'>主营业务</td>
		<td class='pageTitle'>注册时间</td>
      </tr>
<%
  if(request.getAttribute(Constants.KEY_REQUEST_RESULT   )!=null){
     DisplayPage dispage = (DisplayPage)request.getAttribute(Constants.KEY_REQUEST_RESULT);
     String regCompanyDetailUrl = "/admin/shop/manageShop.do?CMD=regCompanyDetail";

     for(int i=0;i<dispage.getList().size();i++){
	     User user = (User)dispage.getList().get(i);
	     Company com = null;
	     if(user.getSubs() != null && user.getSubs().size() > 0){
	         Company[] coms = (Company[])user.getSubs().toArray(new Company[0]);
	         for(int j=0;j<coms.length;j++){
	            if(coms[j].getLanguage().equals(user.getLanguage()) )
	                com = coms[j];
	         }
	         if(com == null)
	             com = coms[0];
	     }else
	         continue;
%>
	    <tr class='row<%=(i%2)%>'> 
	       <td class='pageTd'><%=(i+1)%></td> 
	       <td class='pageTd'><a href="<%=regCompanyDetailUrl+"&userid="+com.getUser().getId()%>">
	                         <%=com.getUser().getUsername()%>(<%=com.getUser().getId()%>) </a>    </td> 
	       <td class='pageTd'><%=com.getName()%> </td> 
	       <td class='pageTd'><%=UTool.getCountryName(com.getUser().getCountry(),sessionLocale)%> </td> 
	       <td class='pageTd'>
<%
			Set mb = com.getMainbusiness();
			if(mb.size() > 0){
				CompanyInd[] mbs = (CompanyInd[])mb.toArray(new CompanyInd[0]);
				if(mbs != null)
					for(int m=0;m<mbs.length;m++){
						if(mbs[m].getIndustry()!= null)
						out.println("<br>"+mbs[m].getIndustry().getName());
					}
			}
%> 
			</td> 
	       <td class='pageTd'>
<% 
			Set mc = com.getMaincatproduct();
			if(mc.size() >0){
				CompanyCat[] mcs = (CompanyCat[])mc.toArray(new CompanyCat[0]);
				if(mcs!=null)
					for(int m=0;m<mcs.length;m++){
					    if(mcs[m].getCatproduct()!= null)
						out.println("<br>"+mcs[m].getCatproduct().getName());
					}
			}
%> 
			</td> 
	       <td class='pageTd'><%=com.getCreatedon()%> </td> 
	    </tr> 
<%
     }
     out.println("</table>");
     out.println(JspHelper.getPageBar(dispage,request.getRequestURL() + "?CMD=searchRegCompany"));
  }else{
   	 out.println("未找到记录");
  }
    
%>


